package com.qf.controller;

import com.qf.service.UserService;
import com.qf.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author:zhangyang
 * @Date: ${Date} 11:09
 * @Version 1.0
 * 批量删除
 */
@WebServlet("/delChecekdServlet")
public class DelChecekdServlet extends HttpServlet {


    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        //点击删除选中---->http://localhost:8080/day_3_25_Partice/delChecekdServlet?uid=1&uid=7&uid=8
        //接收参数  public String[] getParameterValues(String name);
        //获取地址栏上的所有参数值
        String[] uids = request.getParameterValues("uid");
      /*  //测试
        for(String s : uids){
            System.out.println(s);
        }*/

      //调用service
        UserService userService = new UserServiceImpl() ;
        userService.delChecked(uids) ;


        //重定向到findUserList
        response.sendRedirect(request.getContextPath()+"/findUserList");


    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }
}
